package org.ybxb.okhttp.interceptor;

import okhttp3.Interceptor;
import okhttp3.Response;

import java.io.IOException;

/**
 * @ProjectName: generator-report
 * @PackageName: org.ybxb.gr
 * @Description:
 * @Author: hy.bai
 * @Date: 2025-07-08 17:28
 */
public class CacheControlInterceptor implements Interceptor {
  @Override
  public Response intercept(Chain chain) throws IOException {
    Response originalResponse = chain.proceed(chain.request());
    return originalResponse.newBuilder()
            .header("Cache-Control", "public, max-age=" + 3600) // 设置缓存时间为1小时
            .build();
  }
}
